<?php
if(isset($form['#farmer'])&& !empty($form['#farmer'])) {
    echo get_template_header_info($form['#farmer']);
}
?>
<div class="hp-tab-newprd">
    <ul class="j-sw-nav">
            <li class="newprd-s1 tab-li"><a href="<?php echo base_path();?>special_activities/list">查看</a></li>
            <?php if(user_access('add special_activities')){ ?>
            <li class="newprd-s2 tab-li"><a href="<?php echo base_path();?>special_activities/add">添加</a></li>
            <?php }?>
             <li class="newprd-s3 tab-li on"><a href="#">概览</a></li>
        </ul>
    <div class="newprd-s1">
        <div class="table-div">

            <?php 
              $str = "<a href='".base_path()."farmer/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_farmer'><span class='special_activities_title'>农户信息</span>";
            // print_r($form['farmerinfo']);die;
            foreach ($form['farmerinfo'] as $key => $value) {
                foreach ($value as $k => $v) {
                    $str .= '<ul><li class="first_li">'.$v->farmer_name.'</li><li class="second_li">'.$v->cell.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."farmer/plant_info/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_plant_info'><span class='special_activities_title'>种植信息</span>";
            foreach ($form['plant_info'] as $key => $value) {
                foreach ($value as $k => $v) {
                    $str .= '<ul><li class="first_li">'.$v->plant_name.'</li><li class="second_li">'.$v->plant_area.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."farmer/soil_info/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_soil_info'><span class='special_activities_title'>土壤信息</span>";
            foreach ($form['soil_info'] as $key => $value) {
                foreach ($value as $k => $v) {
                    if($v->farmer_name){
                    $str .= '<ul><li class="first_li">'.$v->farmer_name.'</li><li class="second_li">'.date('Y-m-d',$v->timestamp).'</li></ul>';
                }
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."fertilizer_case/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_fertilizer_case'><span class='special_activities_title'>施肥案例</span>";
            foreach ($form['fertilizer_case'] as $key => $value) {
                foreach ($value as $k => $v) {
                    if($v->farmer_name){
                    $str .= '<ul><li class="first_li">'.$v->farmer_name.'</li><li class="second_li">'.date('Y-m-d',$v->timestamp).'</li></ul>';
                    }
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."gift/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_gift'><span class='special_activities_title'>礼物信息</span>";
            foreach ($form['gift'] as $key => $value) {
                foreach ($value as $k => $v) {
                    if($v->gift_type==1){
                        $v->gift_type = '化肥';
                    }else{
                        $v->gift_type = '代金券';
                    }
                    $str .= '<ul><li class="first_li">'.$v->farmer_name.'</li><li class="second_li">'.$v->gift_type.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."plant_measure/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_plant_measure'><span class='special_activities_title'>田间测产</span>";
            foreach ($form['plant_measure'] as $key => $value) {
                foreach ($value as $k => $v) {
                    $str .= '<ul><li class="first_li">'.$v->farmer_name.'</li><li class="second_li">'.$v->plant_name.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."revisit/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_revisit'><span class='special_activities_title'>回访信息</span>";
            foreach ($form['revisit'] as $key => $value) {
                foreach ($value as $k => $v) {
                    $str .= '<ul><li class="first_li">'.$v->farmer_name.'</li><li class="second_li">'.$v->visit_date.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."village/activity/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_village_activity'><span class='special_activities_title'>村落活动</span>";
            foreach ($form['village_activity'] as $key => $value) {
                foreach ($value as $k => $v) {
                    $str .= '<ul><li class="first_li">'.$v->distributor_name.'</li><li class="second_li">'.$v->title.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <?php 
              $str = "<a href='".base_path()."village/list?special_activities=".arg(2)."'><div class='special_activities_div special_activities_village'><span class='special_activities_title'>村落信息</span>";
            foreach ($form['village'] as $key => $value) {
                foreach ($value as $k => $v) {
                    $str .= '<ul><li class="first_li">'.$v->distributor_name.'</li><li class="second_li">'.$v->population.'</li></ul>';
                }
            }
            $str .= '</div></a>';
            echo ($str);
            ?>
            <div style="clear:both"></div>
        </div>
    </div>
</div>
<div style="display: none"><?php print render($form['farmer_info']); ?></div>
 <?php //print drupal_render_children($form); ?>
